<template>
  <div class="home">
    <h1>home 页面 -- {{this.$store.state.name}}</h1>
    <h1>home 页面 -- {{this.$store.getters.getNameGetter}}</h1>
    <button @click="changNameAction">改变 vue 当中的 name 数据</button>
  </div>
</template>

<script>
import { mapActions } from 'vuex'
// import bus from '../bus'
export default {
  name: 'Home',
  components: {
  },
  data () {
    return {
      // name: 'home-name'
    }
  },
  beforeCreate () {
    console.log('home', 'beforeCreate()')
  },
  created () {
    console.log('home', 'created()')
  },
  mounted () {
    console.log('home', 'mounted()')
    // bus.$emit('getHomeName', this.name)
  },
  methods: {
    ...mapActions([
      'changNameAction'
    ])
    // changeName () {
    //   this.$store.dispatch('changNameAction', '在 home 里面改变的name')
    // }
  }
}
</script>
